<template>
  <div class="helloword">
    <div>hello world</div>
    <div style="width:100%;height: 400px">
      <ts-table :source="table2" width="100%" height="400px"></ts-table>
    </div>
  </div>
</template>

<script>
import { tsTable } from 'ts-element';
export default {
  name: 'helloword',
  data() {
    return {
      requestParams: {
        pageNo: 1,
        pageSize: 30
      },
      table2:{
        url: this.promiseFun,
        method: 'get',
        postData: {},
        colModel: this.userColFn3(),
        timeout: 20000,
        showOverflow: true
      }
    }
  },
  components: {
    tsTable
  },
  methods: {
    promiseFun(data){
        let _data = { ...this.requestParams, ...data };
        return new Promise(_res=>{
            this.$api({
              url: "/ts-system/api/ThpsAppModel/list",
              data: _data,
              method: 'get',
            }).then(res=>{
              return _res({
                pageCount: res.pageCount,
                pageNo: res.pageNo,
                pageSize: res.pageSize,
                rows: res.rows,
                statusCode: 200,
                totalCount: res.totalCount
              })
            })
        })
    },
    userColFn3(){
        return [
            {
              title: '名称',
              field: 'sysName'
            },
            {
              title: 'code',
              field: 'sysCode'
            },
        ]
    }
  }
};
</script>

<style scoped>
.helloword {
  background: #fff;
  padding: 14px;
}
</style>
